import axios from '../../axios';

const salesPerson = {
    getSalesPerson: function (params) {
        return axios({
            url: '/salesPerson/getSalesPerson'
        })
    },
    getSales:  ()=>{
          return axios({
            url: '/salesPerson/getSales',
            method: 'get'
          }) 
    },
    addSalesPerson: function (params) {
        return axios({
            url: "/salesPerson/addSalesPerson",
            method: 'post',
            data: {
                salesName: params.salesName,
                salesPassword: params.salesPassword,
                age: params.age,
                gender: params.gender,
                power: 2,
                state: "common"
            }
        })
    },
    deleteSalesPerson: function (params) {
        return axios({
            url: '/salesPerson/deleteSalesPerson',
            method: "post",
            data: {
                _id: params
            }
        })
    },
    updataSalesPerson: function (params) {
        return axios({
            url: "/salesPerson/updataSalesPerson",
            method: 'post',
            data: {
                _id: params._id,
                adminName: params.adminName,
                password: params.password,
                age: params.age,
                gender: params.gender,
                state: params.state
            }
        })
    },
    getCustomer: function (params) {
        return axios({
            url: 'salesPerson/getCustomer',
            method: "post",
            data:{
                _id:params
            }
        })
    }
}

export default salesPerson;